****Desentranando paper. German Campos y Patricio Navia***


clear all
cd "C:\Users\patri\Dropbox\German Campos-Patricio Navia\Desentranando\Stata analysis"
use "C:\Users\patri\Dropbox\German Campos-Patricio Navia\Desentranando\Stata analysis\Variables NEP y NEF Colombia Senado y Cámara 1958-1990.dta"



corr NEPElecciones NELElecciones MD SenadoDummy FNDummy Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion LogPoblacion
**high correlation between DM and population, WE DONT USE LOGPOPULATION***

***coefplot, drop(_cons) xline(0)***




gen FNincremental=.

replace FNincremental = 0 if (Ano == 1958)
replace FNincremental = 1 if (Ano == 1962)
replace FNincremental = 2 if (Ano == 1964)
replace FNincremental = 3 if (Ano == 1966)
replace FNincremental = 4 if (Ano == 1968)
replace FNincremental = 5 if (Ano == 1970)
replace FNincremental = 6 if (Ano ==1974)
replace FNincremental = 7 if (Ano > 1974)
tab FNincremental 


twoway scatter  NEPElecciones Ano || lfit  NEPElecciones Ano
twoway scatter  NELElecciones Ano || lfit  NELElecciones Ano


twoway scatter  NEPCongreso Ano || lfit  NEPCongreso Ano
twoway scatter  NEFCongreso Ano || lfit  NEPCongreso Ano


***Model 1. NEP electoral parties***
regress NELElecciones MD i.SenadoDummy i.FNDummy MDxFNDummy FNincremental i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
vif 


***Model Table 3*** 
***Model 1. NEP electoral parties***
regress NEPElecciones MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
vif 
outreg2 using Tabla3.doc, replace ctitle(M1 ENP in Elections) 

**Model 2. NEP electoral parties***
regress NEPElecciones MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales Urbano Alfabetizacion, vce(robust)
outreg2 using Tabla3.doc, append ctitle(M2 ENP in Elections) 


**Model 3. NEP electoral parties***
regress NEPElecciones MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)
vif
outreg2 using Tabla3.doc, append ctitle(M3 ENP in Elections) 


**Model 4. NEP electoral parties***
regress NEPElecciones MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion, vce(robust)
vif
outreg2 using Tabla3.doc, append ctitle(M4 ENP in Elections) 

***Model 5. NEL electoral parties***
regress NELElecciones MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
vif
outreg2 using Tabla3.doc, append ctitle(M5 ENL in Elections) 


**Model 6. NEL electoral parties***
regress NELElecciones MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales Urbano Alfabetizacion, vce(robust)
vif
outreg2 using Tabla3.doc, append ctitle(M6 ENL in Elections)

**Model 7. NEL electoral parties***
regress NELElecciones MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)
vif 
outreg2 using Tabla3.doc, append ctitle(M7 ENL in Elections) 


**Model 8. NEL electoral parties***
regress NELElecciones MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion, vce(robust)
vif
outreg2 using Tabla3.doc, append ctitle(M8 ENL in Elections) 



**Model Table 4 Regressions only** 
***Model 9. NEP Congress parties***
regress NEPCongreso MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
vif 
outreg2 using Tabla4.doc, replace ctitle(M9 ENP in Congress) 

**Model 10. NEP Congress parties***
regress NEPCongreso MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales Urbano Alfabetizacion, vce(robust)
outreg2 using Tabla4.doc, append ctitle(M10 ENP in Congress) 


**Model 11. NEP Congress parties***
regress NEPCongreso MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)
vif
outreg2 using Tabla4.doc, append ctitle(M11 ENP in Congress) 


**Model 12. NEP Congress parties***
regress NEPCongreso MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion, vce(robust)
vif
outreg2 using Tabla4.doc, append ctitle(M12 ENP in Congress) 

***Model 13. NEF Congress parties***
regress NEFCongreso MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
outreg2 using Tabla4.doc, append ctitle(M13 ENF in Congress) 


**Model 14. NEF Congress parties***
regress NEFCongreso MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales Urbano Alfabetizacion, vce(robust)
outreg2 using Tabla4.doc, append ctitle(M14 ENF in Congress)

**Model 15. NEF Congress parties***
regress NEFCongreso MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)
outreg2 using Tabla4.doc, append ctitle(M15 ENF in Congress) 


**Model 16. NEF Congress parties***
regress NEFCongreso MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion, vce(robust)
outreg2 using Tabla4.doc, append ctitle(M16 ENF in Congress)  


***PREDICTED PROBABILITIES****
***Models Table 3*** 
***Model 1. NEP electoral parties***

regress NEPElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
margins, at(MD=(0(5)30) FNDummy=(0 1)) atmeans vsquish post
marginsplot

**Model 5. NEF electoral lists***
regress NELElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
margins, at(MD==(0(5)30) FNDummy=(0 1)) atmeans vsquish post
marginsplot


**Model 9, Table 4, parties with seats****
regress NEPCongreso MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
margins, at(MD==(0(5)30) FNDummy=(0 1)) atmeans vsquish post
marginsplot

***Model 13, Table 4, parties with seats****
regress NEFCongreso MD i.SenadoDummy i.FNDummy MDxFNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
margins, at(MD==(0(5)30) FNDummy=(0 1)) atmeans vsquish post
marginsplot





***Old stuff****

**Model 3. NEP electoral parties***
regress NEPElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot

margins, at(MD==(0(5)30) FNDummy=(0 1)) atmeans vsquish post
marginsplot


**Model 4. NEP electoral parties***
regress NEPElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion LogPoblacion, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot

margins, at(MD==(0(5)30) FNDummy=(0 1)) atmeans vsquish post
marginsplot


***Model 5. NEP electoral parties***

regress NELElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot

margins, at(MD==(0(5)30) FNDummy=(0 1)) atmeans vsquish post
marginsplot


**Model 6. NEL electoral parties***
regress NELElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal Urbano Alfabetizacion LogPoblacion, vce(robust)

regress NELElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal Urbano Alfabetizacion, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot

margins, at(MD==(0(5)30) FNDummy=(0 1)) atmeans vsquish post
marginsplot


**Model 7. NEL electoral parties***
regress NELElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot

margins, at(MD==(0(5)30) FNDummy=(0 1)) atmeans vsquish post
marginsplot


**Model 8. NEL electoral parties***
regress NELElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion LogPoblacion, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot

margins, at(MD==(0(5)30) FNDummy=(0 1)) atmeans vsquish post
marginsplot



***Model 9. NEP in legislature***

regress NEPCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot


**Model 10. NEP in legislature***
regress NEPCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal Urbano Alfabetizacion LogPoblacion, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot


**Model 11. NEP in legislature***
regress NEPCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot


**Model 12. NEP in legislature***
regress NEPCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion LogPoblacion, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot



***Model 13. NEF in legislature***

regress NEFCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot


**Model 14. NEF in legislature***
regress NEFCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal Urbano Alfabetizacion LogPoblacion, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot


**Model 15. NEF in legislature***
regress NEFCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot


**Model 16. NEF in legislature***
regress NEFCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion LogPoblacion, vce(robust)

margins, at(MD==(0(5)30)) atmeans vsquish post
marginsplot

***hasta aqui llegamos***



**modelos para tablas 6 y 7****
regress NEPElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
outreg2 using Tabla6.doc, replace ctitle(M1 ENP in Elections) 


**Model 2. NEP electoral parties***
regress NEPElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal Urbano Alfabetizacion LogPoblacion, vce(robust)
outreg2 using Tabla6.doc, append ctitle(M2 ENP in Elections) 


**Model 3. NEP electoral parties***
regress NEPElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)
outreg2 using Tabla6.doc, append ctitle(M3 ENP in Elections) 


**Model 4. NEP electoral parties***
regress NEPElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion LogPoblacion, vce(robust)
outreg2 using Tabla6.doc, append ctitle(M4 ENP in Elections) 


***Model 5. NEP electoral parties***

regress NELElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
outreg2 using Tabla6.doc, append ctitle(M5 ENL in Elections) 


**Model 6. NEL electoral parties***
regress NELElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal Urbano Alfabetizacion LogPoblacion, vce(robust)
outreg2 using Tabla6.doc, append ctitle(M6 ENL in Elections) 


**Model 7. NEL electoral parties***
regress NELElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)
outreg2 using Tabla6.doc, append ctitle(M7 ENL in Elections) 


**Model 8. NEL electoral parties***
regress NELElecciones MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion LogPoblacion, vce(robust)
outreg2 using Tabla6.doc, append ctitle(M8 ENL in Elections) 


**Model Table 7 Regressions only** 
***Model 9. NEP in legislature***

regress NEPCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
outreg2 using Tabla7.doc, replace ctitle(M9 ENP in Legislature) 



**Model 10. NEP in legislature***
regress NEPCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal Urbano Alfabetizacion LogPoblacion, vce(robust)
outreg2 using Tabla7.doc, append ctitle(M10 ENP in Legislature) 


**Model 11. NEP in legislature***
regress NEPCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)
outreg2 using Tabla7.doc, append ctitle(M11 ENP in Legislature) 

**Model 12. NEP in legislature***
regress NEPCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion LogPoblacion, vce(robust)
outreg2 using Tabla7.doc, append ctitle(M12 ENP in Legislature) 


***Model 13. NEF in legislature***

regress NEFCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumerodeUnidadesElectorales, vce(robust)
outreg2 using Tabla7.doc, append ctitle(M13 ENL in Legislature) 


**Model 14. NEF in legislature***
regress NEFCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal Urbano Alfabetizacion LogPoblacion, vce(robust)
outreg2 using Tabla7.doc, append ctitle(M14 ENL in Legislature) 


**Model 15. NEF in legislature***
regress NEFCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara, vce(robust)
outreg2 using Tabla7.doc, append ctitle(M15 ENL in Legislature) 


**Model 16. NEF in legislature***
regress NEFCongreso MD i.SenadoDummy i.FNDummy i.Dummypresidenteliberal NumeroEscanosCamara Urbano Alfabetizacion LogPoblacion, vce(robust)
outreg2 using Tabla7.doc, append ctitle(M16 ENL in Legislature) 

